import { Index } from "solid-js";
import type { TableRowProps } from "./types";
import { TableCell } from "./TableCell";

export const TableRow = <T = {},>(props: TableRowProps<T>) => {
    return (
        <tr>
            <Index each={props.columns ?? []}>
                {(column, index) => (
                    <TableCell
                        data={props.data}
                        column={column()}
                        rowIndex={props.index}
                        columnIndex={index}
                    ></TableCell>
                )}
            </Index>
        </tr>
    );
};